3.2.76 \(\int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx\) [176]

3.2.76.1 Optimal result
3.2.76.2 Mathematica [C] (warning: unable to verify)
3.2.76.3 Rubi [A] (verified)
3.2.76.4 Maple [F]
3.2.76.5 Fricas [F]
3.2.76.6 Sympy [F]
3.2.76.7 Maxima [F]
3.2.76.8 Giac [F(-2)]
3.2.76.9 Mupad [F(-1)]

3.2.76.1 Optimal result

Integrand size = 34, antiderivative size = 180 \[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=-\frac {c g (1-2 p) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-p}{2},\frac {3-p}{2},\cos ^2(e+f x)\right ) (g \sec (e+f x))^{-1+p} \sin (e+f x)}{a f (1-p) \sqrt {\sin ^2(e+f x)}}+\frac {2 c \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {p}{2},\frac {2-p}{2},\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f \sqrt {\sin ^2(e+f x)}}-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))} \]

output
-c*g*(1-2*p)*hypergeom([1/2, 1/2-1/2*p],[3/2-1/2*p],cos(f*x+e)^2)*(g*sec(f 
*x+e))^(-1+p)*sin(f*x+e)/a/f/(1-p)/(sin(f*x+e)^2)^(1/2)+2*c*hypergeom([1/2 
, -1/2*p],[1-1/2*p],cos(f*x+e)^2)*(g*sec(f*x+e))^p*sin(f*x+e)/a/f/(sin(f*x 
+e)^2)^(1/2)-2*c*(g*sec(f*x+e))^p*tan(f*x+e)/f/(a+a*sec(f*x+e))
 
3.2.76.2 Mathematica [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 6 vs. order 5 in optimal.

Time = 14.79 (sec) , antiderivative size = 3396, normalized size of antiderivative = 18.87 \[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=\text {Result too large to show} \]

input
Integrate[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x 
]
 
output
(-6*c*Sec[e + f*x]^p*(g*Sec[e + f*x])^p*Tan[(e + f*x)/2]^3*(-((AppellF1[1/ 
2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2 
]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2] 
^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e 
 + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Ta 
n[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e 
 + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f 
*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e 
+ f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + 
 f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)))/(a*f*(3*Sec[(e + f 
*x)/2]^2*Sec[e + f*x]^p*(-((AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^ 
2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2 
, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 
2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + 
 p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2] 
^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/ 
(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2* 
p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 
 AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*T 
an[(e + f*x)/2]^2)) + 6*p*Sec[e + f*x]^(1 + p)*Sin[e + f*x]*Tan[(e + f*...
 
3.2.76.3 Rubi [A] (verified)

Time = 0.72 (sec) , antiderivative size = 181, normalized size of antiderivative = 1.01, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {3042, 4508, 3042, 4274, 3042, 4259, 3042, 3122}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(c-c \sec (e+f x)) (g \sec (e+f x))^p}{a \sec (e+f x)+a} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (c-c \csc \left (e+f x+\frac {\pi }{2}\right )\right ) \left (g \csc \left (e+f x+\frac {\pi }{2}\right )\right )^p}{a \csc \left (e+f x+\frac {\pi }{2}\right )+a}dx\)

\(\Big \downarrow \) 4508

\(\displaystyle \frac {\int (g \sec (e+f x))^p (a c (1-2 p)+2 a c p \sec (e+f x))dx}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \left (g \csc \left (e+f x+\frac {\pi }{2}\right )\right )^p \left (a c (1-2 p)+2 a c p \csc \left (e+f x+\frac {\pi }{2}\right )\right )dx}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 4274

\(\displaystyle \frac {a c (1-2 p) \int (g \sec (e+f x))^pdx+\frac {2 a c p \int (g \sec (e+f x))^{p+1}dx}{g}}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a c (1-2 p) \int \left (g \csc \left (e+f x+\frac {\pi }{2}\right )\right )^pdx+\frac {2 a c p \int \left (g \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{p+1}dx}{g}}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 4259

\(\displaystyle \frac {\frac {2 a c p \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p \int \left (\frac {\cos (e+f x)}{g}\right )^{-p-1}dx}{g}+a c (1-2 p) \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p \int \left (\frac {\cos (e+f x)}{g}\right )^{-p}dx}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {2 a c p \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{g}\right )^{-p-1}dx}{g}+a c (1-2 p) \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{g}\right )^{-p}dx}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

\(\Big \downarrow \) 3122

\(\displaystyle \frac {\frac {2 a c \sin (e+f x) (g \sec (e+f x))^p \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {p}{2},\frac {2-p}{2},\cos ^2(e+f x)\right )}{f \sqrt {\sin ^2(e+f x)}}-\frac {a c g (1-2 p) \sin (e+f x) (g \sec (e+f x))^{p-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-p}{2},\frac {3-p}{2},\cos ^2(e+f x)\right )}{f (1-p) \sqrt {\sin ^2(e+f x)}}}{a^2}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)}\)

input
Int[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x]
 
output
(-((a*c*g*(1 - 2*p)*Hypergeometric2F1[1/2, (1 - p)/2, (3 - p)/2, Cos[e + f 
*x]^2]*(g*Sec[e + f*x])^(-1 + p)*Sin[e + f*x])/(f*(1 - p)*Sqrt[Sin[e + f*x 
]^2])) + (2*a*c*Hypergeometric2F1[1/2, -1/2*p, (2 - p)/2, Cos[e + f*x]^2]* 
(g*Sec[e + f*x])^p*Sin[e + f*x])/(f*Sqrt[Sin[e + f*x]^2]))/a^2 - (2*c*(g*S 
ec[e + f*x])^p*Tan[e + f*x])/(f*(a + a*Sec[e + f*x]))
 

3.2.76.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 4259
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^(n - 1)*((Sin[c + d*x]/b)^(n - 1)   Int[1/(Sin[c + d*x]/b)^n, x]), x] /; 
FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]
 

rule 4274
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_)), x_Symbol] :> Simp[a   Int[(d*Csc[e + f*x])^n, x], x] + Simp[b/d   In 
t[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]
 

rule 4508
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b 
- a*B))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(b*f*(2*m + 
 1))), x] - Simp[1/(a^2*(2*m + 1))   Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Cs 
c[e + f*x])^n*Simp[b*B*n - a*A*(2*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[ 
e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B 
, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0]
 
3.2.76.4 Maple [F]

\[\int \frac {\left (g \sec \left (f x +e \right )\right )^{p} \left (c -c \sec \left (f x +e \right )\right )}{a +a \sec \left (f x +e \right )}d x\]

input
int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)
 
output
int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)
 
3.2.76.5 Fricas [F]

\[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=\int { -\frac {{\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p}}{a \sec \left (f x + e\right ) + a} \,d x } \]

input
integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm= 
"fricas")
 
output
integral(-(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)
 
3.2.76.6 Sympy [F]

\[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=- \frac {c \left (\int \left (- \frac {\left (g \sec {\left (e + f x \right )}\right )^{p}}{\sec {\left (e + f x \right )} + 1}\right )\, dx + \int \frac {\left (g \sec {\left (e + f x \right )}\right )^{p} \sec {\left (e + f x \right )}}{\sec {\left (e + f x \right )} + 1}\, dx\right )}{a} \]

input
integrate((g*sec(f*x+e))**p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)
 
output
-c*(Integral(-(g*sec(e + f*x))**p/(sec(e + f*x) + 1), x) + Integral((g*sec 
(e + f*x))**p*sec(e + f*x)/(sec(e + f*x) + 1), x))/a
 
3.2.76.7 Maxima [F]

\[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=\int { -\frac {{\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p}}{a \sec \left (f x + e\right ) + a} \,d x } \]

input
integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm= 
"maxima")
 
output
-integrate((c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x 
)
 
3.2.76.8 Giac [F(-2)]

Exception generated. \[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=\text {Exception raised: TypeError} \]

input
integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm= 
"giac")
 
output
Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Unable to divide, perhaps due to ro 
unding error%%%{1,[0,1,2,0]%%%}+%%%{1,[0,1,0,0]%%%} / %%%{2,[0,0,0,1]%%%} 
Error: Ba
 
3.2.76.9 Mupad [F(-1)]

Timed out. \[ \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx=\int \frac {\left (c-\frac {c}{\cos \left (e+f\,x\right )}\right )\,{\left (\frac {g}{\cos \left (e+f\,x\right )}\right )}^p}{a+\frac {a}{\cos \left (e+f\,x\right )}} \,d x \]

input
int(((c - c/cos(e + f*x))*(g/cos(e + f*x))^p)/(a + a/cos(e + f*x)),x)
 
output
int(((c - c/cos(e + f*x))*(g/cos(e + f*x))^p)/(a + a/cos(e + f*x)), x)